use tiles::*;
use std::io;
use clap::{Arg, App};

fn main() -> io::Result<()> {
    let matches = App::new("tilesd")
        .version("1.0.1")
        .author("dev-tang.com <36634584@qq.com>,zhaokaiyuan <zhaoky0918@sina.com>")
        .about("rust tiles server")
        .arg(Arg::with_name("port")
            .short("p")
            .long("p")
            .value_name("INTEGER")
            .help("设置端口, 默认值8900")
            .takes_value(true))
        .get_matches();
    let port = matches.value_of("port").unwrap_or("8900");
    println!("{}{}", "listening 0.0.0.0:", port);

    server::start(&format!("0.0.0.0:{}", port))?;

    Ok(())
}
